package cn.xmoit.flowable.controller;

import cn.xmoit.flowable.model.ApproveRejectVO;
import cn.xmoit.flowable.model.AskForLeaveVO;
import cn.xmoit.flowable.model.Result;
import cn.xmoit.flowable.service.AskForLeaveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author fangyy
 */
@RestController
public class AskForLeaveController {

	@Autowired
	AskForLeaveService askForLeaveService;

	@PostMapping("/ask_for_leave")
	public Result askForLeave(@RequestBody AskForLeaveVO askForLeaveVO) {
		return askForLeaveService.askForLeave(askForLeaveVO);
	}

	@GetMapping("/list")
	public Result leaveList() {
		return askForLeaveService.leaveList();
	}

	@PostMapping("/handler")
	public Result askForLeaveHandler(@RequestBody ApproveRejectVO approveRejectVO) {
		return askForLeaveService.askForLeaveHandler(approveRejectVO);
	}

	@GetMapping("/search")
	public Result searchResult() {
		return askForLeaveService.searchResult();
	}

}
